Skip to content

fix(ext/node): emit resize event on SIGWINCH #27363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Dec 14, 2024

process.stdout.on("resize", () => {
  console.log(`resize ${process.stdout.columns}x${process.stdout.rows}`);
});

Fixes #26671

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once main is merged in.

if (stdout.isTTY) {
Deno.addSignalListener("SIGWINCH", () => {
stdout.emit("resize");
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this doesn't work on Windows? Will this error?

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment. I think this will throw an exception on Windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resize event on stdout not invoked in TTY on macOS
2 participants